/*
File:		Entity.h
Author:		Ben Feldmann
Purpose:	Base class for game entities
*/


#pragma once


#include <Windows.h>
#include "IEntity.h"
#include "SGD Wrappers\SGD_Math.h"

enum EntityTypes {OBJECT_BASE, OBJ_PLAYER, OBJ_ENEMY, OBJ_BULLET, OBJ_TILE, OBJ_PICKUP, OBJ_WEAPON, OBJ_WALL, OBJ_TRIGGER, OBJ_CHEST, OBJ_HAZARD};


class Entity : public IEntity 
{
private:
	float posX;
	float posY;
	int width;
	int height;
	int textureID;
	int direction;

public:
	Entity();

	virtual ~Entity() {}

	virtual void Update(float elapsed);

	virtual void Render();

	virtual RECT GetRect();

	virtual int GetType();

	virtual bool CheckCollision(IEntity* base);

	// Accessors
	float			GetX(void) const			{return posX;}
	float			GetY(void) const			{return posY;}
	void SetPosition(int x, int y)				{SetX((float)x); SetY((float)y);}
	unsigned int	GetWidth(void) const		{return width;}	
	unsigned int	GetHeight(void) const		{return height;}
	int				GetTextureID(void) const	{return textureID;}
	int				GetDirection(void) const	{return direction;}
	tVector2D       GetVectorPos() const				
	{
		tVector2D tmp;
		tmp.fX = posX;
		tmp.fY = posY;

		return tmp;
	}

	// Mutators
	void SetX(float x)				{posX	   = x;}
	void SetY(float y)				{posY	   = y;}	
	void SetX(int x)				{posX	   = (float)(x);}
	void SetY(int y)				{posY	   = (float)(y);}
	void SetWidth(unsigned int w)	{width	   = w;}	
	void SetHeight(unsigned int h)	{height    = h;}
	void SetTextureID(int id)		{textureID = id;}
	virtual void SetDirection(int d)		{direction = d;}

	// Smart Pointer stuff
	virtual void AddRef(void);
	virtual void Release(void);

protected:
	int type;

private:

	// Number of references for the smart pointers
	unsigned int RefCount;

};
